<?php
namespace app\admin\controller;
use cmf\controller\AdminBaseController;
use app\common\model\VersionModel;
/**
 * 版本管理
 */
class VersionController extends AdminBaseController
{
	public function index(){
		$param = $this->request->param();
		$data[1] = VersionModel::where('type',1)->order('version_id desc')->find();
		//$data[2] = VersionModel::where('type',2)->order('version_id desc')->find();
		$this->assign('data',$data);
		return $this->fetch();
	}

	public function edit(){
		$param = $this->request->param();
		$data = VersionModel::get($param['version_id']);
		$this->assign('data',$data);
		return $this->fetch();
	}
	
	public function toEdit(VersionModel $Version)
	{
		$param = $this->request->param();
		$rs = $Version->save($param['post']);
		if($rs){
			$this->success('操作成功','index');
		}else{
			$this->error('操作失败');
		}
	}
	
}
